package br.com.escolaespacocrianca.fineec.component;

import br.com.caelum.vraptor.core.Localization;
import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.validator.I18nMessage;

@Component
public class Resources {

	private static Localization localization;

	public Resources(Localization localization) {
		Resources.localization = localization;
	}
	
	public static I18nMessage getMessage(String key) {
		I18nMessage message = new I18nMessage("default",key);  
		message.setBundle(localization.getBundle());
		return message;
	} 
	
	public static I18nMessage getMessage(String key, String category) {
		I18nMessage message = new I18nMessage(category,key);  
		message.setBundle(localization.getBundle());
		return message;
	} 
	
	public static String getString(String key) {
		I18nMessage message = new I18nMessage("default",key);  
		message.setBundle(localization.getBundle());
		return message.getMessage();
	}  
	
	public static String getString(String key, String category) {
		I18nMessage message = new I18nMessage(category,key);  
		message.setBundle(localization.getBundle());
		return message.getMessage();
	} 
	
}
